#include <stdio.h>

int a[100] = {0};

int main()
{
	int n = 0;
	int cnt = 0;
	scanf("%d", &n);
	for ( int i = 0; i < n; i++ ) {
		scanf("%d", &a[i]);
	}

	for ( int i = 0; i < n; i++ ) {
		int flag = 0;
		for ( int j = 0; j < n; j ++ ) {
			for (int k = j + 1; k < n; k++) {
				if ( j != i && k != i && a[j] + a[k] == a[i] ) {
					cnt ++;
					flag = 1;
					break;
				}
			}
			if ( flag ) {
				break;
			}
		}
	}
	printf("%d", cnt);
	return 0;
} 
